#include "readwidget.h"
#include "ui_readwidget.h"
#include <QPainter>

ReadWidget::ReadWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ReadWidget)
{
    ui->setupUi(this);
    this->setStyleSheet("background-color: white;");
    this->setAttribute(Qt::WA_TranslucentBackground);

    // 只设置一次窗口标志，使用正确的组合
    this->setWindowFlags(Qt::FramelessWindowHint | Qt::SubWindow);

}

ReadWidget::~ReadWidget()
{
    delete ui;
}

void ReadWidget::paintEvent(QPaintEvent *event)
{
    QWidget::paintEvent(event); // 保持正常绘制

    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);

    QPen pen(QColor("#CCCCCC"));
    pen.setWidth(1);
    painter.setPen(pen);
    painter.setBrush(Qt::white);

    QRect rect = this->rect().adjusted(1, 1, -1, -1); // 稍微缩小1像素
    painter.drawRoundedRect(rect, 10, 10);
}
